package org.huangrui.javaee.controller;

import jakarta.annotation.Resource;
import org.huangrui.entities.User;
import org.huangrui.javaee.service.UserService;
import org.springframework.web.bind.annotation.*;

/**
 * @Author hr
 * @Create 2025-11-02 12:08
 **/
@RestController
public class T01UserController {
    @Resource
    private UserService userService;

    @PostMapping(value = "/user/add")
    public int addUser(@RequestBody User user)
    {
        return userService.addUser(user);
    }

    @GetMapping(value = "/user/{id}")
    public User getUserById(@PathVariable("id") Integer id)
    {
        return userService.getUserById(id);
    }

}
